package com.op.handler;

import com.op.response.ResponseResult;
import com.op.response.StateCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 统一异常处理类
 * ClassName： ExceptionHandler
 * Date： 2021/10/5 11:53
 *
 * @author 孤焰
 * @version 1.0
 **/

@RestControllerAdvice
public class UnifyExceptionHandler {
    @ExceptionHandler
    ResponseResult<Object> defaultExceptionHandle(Exception e) {
        return ResponseResult.fail(StateCode.CUSTOMIZE_ERROR.getCode(), e.getMessage());
    }
}
